<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:87:"D:\www\photo_album_bless\public_html/../application/wxapplet\view\template\addtask.html";i:1546393808;s:69:"D:\www\photo_album_bless\application\wxapplet\view\shared\layout.html";i:1546393808;}*/ ?>
<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:16:41 GMT -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <title>新增消息模版</title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="stylesheet" href="/static/plugins/bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/sys/css/style.min.css">
    <link rel="stylesheet" href="/static/plugins/bootstrap-table/bootstrap-table.css">
    <link rel="stylesheet" href="/static/plugins/dataTables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    
    <script src="/static/plugins/jquery-1.12.4/jquery-1.12.4.min.js"></script>
    <script src="/static/plugins/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/static/plugins/layui/layui.js"></script>
    <style>
        .text-red{color:red;}
        .text-green{color:#17bb46;}
        .text-orange{color:orange;}
        .text-yellow{color:#c7cd2f;}
        .text-blue{color:#0bb8c8;}
        .fixed-table-toolbar .bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top:-45px;}
        .th-inner{color:#555;}
    </style>
    

</head>

<body class="gray-bg">
    
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form method="post" id="fmNew" class="form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">任务名称：</label>
                                <div class="col-sm-4">
                                    <input type="text" id="txttaskname" name="task_name" class="form-control" placeholder="请输入名称">
                                </div>                                                                
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">发送时间：</label>
                                <div class="col-sm-3">
                                    <input type="text" id="txtexecute_time" name="execute_time" class="laydate-icon input-sm form-control" placeholder="请输入执行时间"  onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss' })">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">发送模版：</label>
                                <div class="col-sm-4">
                                    <input type="hidden" id="hdtemp_id" name="temp_id" />
                                    <input type="text" id="txttemp_name" name="temp_name" class="form-control" readonly />
                                </div>
                                <div class="col-sm-1">
                                    <input type="button" class="btn btn-primary" id="btntemp" value="选择模版" onclick="openTemplateText()">
                                </div>
                            </div>                            
                            <div class="form-group">
                                <div class="col-sm-12 col-sm-offset-5">
                                    <button class="btn btn-primary" id="ok" type="button">提交</button>
                                    <button class="btn btn-white" id="cancel" type="button">取消</button>
                                </div>
                            </div>
                        </div>                        
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>        

</body>
        
    <script type="text/javascript">
        $(document).ready(function () {
            $("#ok").bind("click", Save);
            $("#cancel").bind("click", function () {
                parent.layer.close(parent.layer_add_index);
            });
        })
        
        function Save() {
            layui.use(['layer'], function(){       
                var taskname =$.trim($("#txttaskname").val());
                if (taskname.length == 0) {
                    layer.tips('任务名称不能为空！', '#txttaskname', { tips: [2, '#78BA32'] });
                    return false;
                }
                var execute_time =$.trim($("#txtexecute_time").val());
                if (execute_time.length == 0) {
                    layer.tips('执行时间不能为空！', '#txtexecute_time', { tips: [2, '#78BA32'] });
                    return false;
                }
                var temp_id =$.trim($("#hdtemp_id").val());
                if (temp_id.length == 0) {
                    layer.tips('执行模版不能为空！', '#btntemp', { tips: [2, '#78BA32'] });
                    return false;
                }


                var load_index = layer.load(0, { shade: false });
                $.ajax({
                    type: "post",
                    url: "<?php echo url('template/addtask'); ?>?t=" + new Date(),
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function (result) {
                        layer.close(load_index);
                        if (result.code == 0) {
                            layer.alert('保存成功！', function () {
                                if (typeof (parent.initTable) == "function")
                                    parent.initTable();
                                parent.layer.close(parent.layer_add_index)
                            });
                        } else {
                            layer.alert(result.msg);
                        }
                    }
                });
            })
        }

        var layer_sel_index;
        function openTemplateText(idx){
            layui.use(['layer'], function(){
                layer_sel_index = layer.open({
                    type: 2,
                    title: "选择消息模版",
                    shadeClose: true,
                    shade: false,
                    area:['80%', '95%'],
                    content:["<?php echo url('template/selTemplate'); ?>"]
                })
            })
        }

        function select_result(d){
            $("#hdtemp_id").val(d.id);
            $("#txttemp_name").val(d.temp_name);
            layer.close(layer_sel_index);
        }
    </script>

<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:17:11 GMT -->
</html>